package com.ruoyi.net.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.net.domain.BusiMtnGroupPort;
import com.ruoyi.net.domain.BusiMtnGroupPortListVo;
import com.ruoyi.net.mapper.BusiMtnGroupPortMapper;
import com.ruoyi.net.service.IBusiMtnGroupPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 业务-mtnGroup配置端口信息Service业务层处理
 * 
 * @author net
 * @date 2024-12-07
 */
@Service
public class BusiMtnGroupPortServiceImpl implements IBusiMtnGroupPortService 
{
    @Autowired
    private BusiMtnGroupPortMapper busiMtnGroupPortMapper;

    /**
     * 查询业务-mtnGroup配置端口信息
     * 
     * @param id 业务-mtnGroup配置端口信息主键
     * @return 业务-mtnGroup配置端口信息
     */
    @Override
    public BusiMtnGroupPort selectBusiMtnGroupPortById(String id)
    {
        return busiMtnGroupPortMapper.selectBusiMtnGroupPortById(id);
    }

    /**
     * 查询业务-mtnGroup配置端口信息列表
     * 
     * @param busiMtnGroupPort 业务-mtnGroup配置端口信息
     * @return 业务-mtnGroup配置端口信息
     */
    @Override
    public List<BusiMtnGroupPortListVo> selectBusiMtnGroupPortList(BusiMtnGroupPort busiMtnGroupPort)
    {
        return busiMtnGroupPortMapper.selectBusiMtnGroupPortList(busiMtnGroupPort);
    }

    /**
     * 新增业务-mtnGroup配置端口信息
     * 
     * @param busiMtnGroupPort 业务-mtnGroup配置端口信息
     * @return 结果
     */
    @Override
    public int insertBusiMtnGroupPort(BusiMtnGroupPort busiMtnGroupPort)
    {
        String uuid = IdUtils.simpleUUID();
        if (StringUtils.isEmpty(busiMtnGroupPort.getId())) {
            busiMtnGroupPort.setId(uuid);
        }
        busiMtnGroupPort.setCreateBy(SecurityUtils.getUsername());
        busiMtnGroupPort.setCreateTime(DateUtils.getNowDate());
        busiMtnGroupPort.setUpdateBy(SecurityUtils.getUsername());
        busiMtnGroupPort.setUpdateTime(DateUtils.getNowDate());
        return busiMtnGroupPortMapper.insertBusiMtnGroupPort(busiMtnGroupPort);
    }

    /**
     * 修改业务-mtnGroup配置端口信息
     * 
     * @param busiMtnGroupPort 业务-mtnGroup配置端口信息
     * @return 结果
     */
    @Override
    public int updateBusiMtnGroupPort(BusiMtnGroupPort busiMtnGroupPort)
    {
        busiMtnGroupPort.setUpdateBy(SecurityUtils.getUsername());
        busiMtnGroupPort.setUpdateTime(DateUtils.getNowDate());
        return busiMtnGroupPortMapper.updateBusiMtnGroupPort(busiMtnGroupPort);
    }

    /**
     * 批量删除业务-mtnGroup配置端口信息
     * 
     * @param ids 需要删除的业务-mtnGroup配置端口信息主键
     * @return 结果
     */
    @Override
    public int deleteBusiMtnGroupPortByIds(String[] ids)
    {
        return busiMtnGroupPortMapper.deleteBusiMtnGroupPortByIds(ids);
    }

    /**
     * 删除业务-mtnGroup配置端口信息信息
     * 
     * @param id 业务-mtnGroup配置端口信息主键
     * @return 结果
     */
    @Override
    public int deleteBusiMtnGroupPortById(String id)
    {
        return busiMtnGroupPortMapper.deleteBusiMtnGroupPortById(id);
    }

    @Override
    public List<BusiMtnGroupPortListVo> caculatePhyList(BusiMtnGroupPort busiMtnGroupPort) {
        return busiMtnGroupPortMapper.selectBusiMtnGroupPortList(busiMtnGroupPort);
    }
}
